package com.aboo.es.vo;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

//indexName：对应索引库名称
//type：对应在索引库中的类型
//shards：分片数量，默认5
//replicas：副本数量，默认1
@Data
@Document(indexName = "actor", type = "_doc", shards = 5, replicas = 1)
public class Actor implements Serializable {

    public Actor() {
    }

    public Actor(String name, String sex, String desc) {
        this.name = name;
        this.sex = sex;
        this.desc = desc;
    }

    @Id
    private String actorCode;

    @Field(type = FieldType.Keyword)
    private String name;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String sex;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String desc;

    @Field(type = FieldType.Date)
    private Date createdDate;

}
